<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>任务详情</title>
    <jsp:include page="common/common_head.jsp"></jsp:include>

    <link rel="stylesheet" href="../codemirror-4.10/lib/codemirror.css">
    <link rel="stylesheet" href="../codemirror-4.10/addon/display/fullscreen.css">
    <link rel="stylesheet" href="../codemirror-4.10/theme/midnight.css">
    <link rel="stylesheet" href="../codemirror-4.10/theme/eclipse.css">

    <link rel="stylesheet" href="../codemirror-4.10/addon/dialog/dialog.css">
    <link rel="stylesheet" href="../codemirror-4.10/addon/search/matchesonscrollbar.css">

    <script src="../codemirror-4.10/lib/codemirror.js"></script>
    <script src="../codemirror-4.10/mode/shell/shell.js"></script>


    <link rel="stylesheet" href="../codemirror-4.10/addon/hint/show-hint.css" />
    <script src="../codemirror-4.10/addon/hint/show-hint.js"></script>
    <script src="../codemirror-4.10/addon/display/fullscreen.js"></script>
    <script src="../codemirror-4.10/addon/selection/active-line.js"></script>

    <script src="../codemirror-4.10/keymap/sublime.js"></script>

    <script src="../codemirror-4.10/addon/dialog/dialog.js"></script>
    <script src="../codemirror-4.10/addon/search/searchcursor.js"></script>
    <script src="../codemirror-4.10/addon/search/search.js"></script>
    <script src="../codemirror-4.10/addon/scroll/annotatescrollbar.js"></script>
    <script src="../codemirror-4.10/addon/search/matchesonscrollbar.js"></script>


    <style type="text/css">
        body {line-height: 1}
        th {text-decoration: "auto"}
    </style>

</head>
<body data-spy="scroll" data-target=".navbar">


<jsp:include page="common/common_banner_app.jsp"></jsp:include>
<div style="height:30px"></div>


<div class="container">

    <table class="table  table-striped table-bordered table-hover " id="showTable">

        <thead>
        <tr>
            <th>序号</th>
            <th>任务号</th>
            <th>执行服务器名称</th>
            <th>超时</th>
            <th>完成</th>
            <th>失败</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${tasks}" var="c" varStatus="v">
            <tr>
                <td>${v.index + 1}</td>
                <td>${c.task.taskId}</td>
                <td>${c.task.hostName}</td>
                <td>${c.status.isTimeout}</td>
                <td>${c.status.finished}</td>
                <td>${c.status.isError}</td>
            </tr>
        </c:forEach>

        </tbody>

    </table>
    <c:forEach items="${tasks}" var="c" varStatus="v">

    </c:forEach>

    <div >
        <textarea id="area">${c.message}</textarea>
    </div>
    <jsp:include page="common/common_js.jsp"></jsp:include>

    <script type="application/javascript" src="/js/log.js"></script>

    <script>

        //window.editor = 123;
        $(document).ready(function(){

            window.editor = CodeMirror.fromTextArea(document.getElementById("area"), {
                mode: "shell",
                indentWithTabs: true,
                smartIndent: true,
                lineNumbers: true,
                lineWrapping: true,
                matchBrackets : true,
                autofocus: true,
                height: "1000",
                lines: 300,
                theme: "eclipse",
                styleActiveLine: true,
                extraKeys: {
                    //"Ctrl-.": "autocomplete",
                    //"Ctrl-Enter": function(){search()},
                    "F10": function(cm) {
                        if(cm.getOption("fullScreen")){
                            $(".navbar").css("display", "");
                            cm.setOption("theme", "eclipse");

                        }else{
                            cm.setOption("theme", "midnight");
                            $(".navbar").css("display", "none")

                        }
                        cm.setOption("fullScreen", !cm.getOption("fullScreen"));

                    }

                },
                hintOptions: {tables: {
                    users: {name: null, score: null, birthDate: null},
                    countries: {name: null, population: null, size: null}
                }}
            });
           // window.editor = editor;

            reSizeHeight('showTable')

        })



    </script>
</body>
</html>